<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:nwisdocs="http://wales.nhs.uk/nwis/docs"
	exclude-result-prefixes="xs xsi">
	
	<xsl:template name="characteristics" match="nwisdocs:DocumentBody/nwisdocs:Observations">
    <xsl:choose>
      <xsl:when test="(nwisdocs:Height/nwisdocs:QuantityValue[text()!='']) or (nwisdocs:Weight/nwisdocs:QuantityValue[text()!=''])">
        <div class="boxed-section" id="{local-name()}">
          <h2>Patient characteristics</h2>
          <div class="inline-content">
            <label>
              Height (<xsl:value-of select="nwisdocs:Height/nwisdocs:QuantityUnit"/>)
            </label>
            <xsl:value-of select="nwisdocs:Height/nwisdocs:QuantityValue"/>
            <br />
            <label>
              Weight (<xsl:value-of select="nwisdocs:Weight/nwisdocs:QuantityUnit"/>)
            </label>
            <xsl:value-of select="nwisdocs:Weight/nwisdocs:QuantityValue"/>
          </div>
        </div>
      </xsl:when>
    </xsl:choose>
		
	</xsl:template>
		
</xsl:stylesheet>
